<?php
namespace plugins\alarm\model;

use plugins\address\model\AddressModel;
use think\Model;

/**
 * 设备模型
 */
class AlarmModel extends Model
{
//     protected  $alarm_type = ['人为报警','监控报警','气象报警','风险评估报警'];
    /**
     * 详情
     */
    public function getDetail($item){
        $item['monitor_time'] = date('Y-m-d H:i:s',$item['monitor_time']);
        $detail_status = '未处理';
        if($item['deal_status'] == 1){
            $detail_status = '已处理';
        }
        if($item['deal_status'] == 2){
            $detail_status = '火情误报,已处理';
        }
        $item['detail_status_str'] = $detail_status;
        //过火面积
        if(!empty($item['burned_area'])){
            $item['burned_area'] .= '公顷';
        }
        //获取地区
        $cri_name = '';
        $addressModel = new AddressModel();
        $address = $addressModel->where('cri_code',$item['cri_code'])->find();
        if(!empty($address)){
            $cri_name = $address['cri_name'];
        }
        $item['cri_name'] = $cri_name;
        //报警类型
//        $item['alarm_type'] = $this->alarm_type[$item['alarm_type']-1];
        return $item;
    }


}
